package com.example.administrator.szb.xzyw;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.Button;
import android.widget.TextView;

import com.example.administrator.szb.R;
import com.example.administrator.szb.activity.HomeActivity;
import com.example.administrator.szb.activity.base.BaseActivity;
import com.example.administrator.szb.config.FragmentsFlag;
import com.example.administrator.szb.tinkerutil.SampleApplicationLike;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;


/**
 * Created by D N on 2017/11/1.
 */

public class SuccessActivity extends BaseActivity {
    @Bind(R.id.success_button_fhsy)
    Button successButtonFhsy;
    int who;//判断从那个页面跳过的。
    @Bind(R.id.success_text_one)
    TextView successTextOne;
    @Bind(R.id.success_text_two)
    TextView successTextTwo;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.success_activity);
        ButterKnife.bind(this);
        SampleApplicationLike.getActivitiesInstance().add(this);
        initToolbar(R.id.success_toolbar_include, "提交成功");
        hasIntent();
    }

    private void hasIntent() {
        who = getIntent().getIntExtra("who", -1);
        if (who == FragmentsFlag.XMXQActivity.ordinal()) {
            initToolbar(R.id.success_toolbar_include, "接单成功");
            successTextOne.setText("接单成功！");
            successTextTwo.setText("平台客服将为您对接上市公司");
            successButtonFhsy.setText("确认");
        }
    }

    @OnClick(R.id.success_button_fhsy)
    public void onViewClicked() {
       if (who == FragmentsFlag.XMXQActivity.ordinal()){
           finish();
       }else {
           startActivity(new Intent(this, HomeActivity.class));
           finish();
       }
    }
}
